import Vue from 'vue'
import localDb from '../../utils/localDb'
import { getProject } from '../../utils/api'
const state = {
    projectInfos:localDb.get('projectInfos'),  //项目信息
}

const mutations = {
    setProjectInfos(state, payLoad) {
        localDb.set('projectInfos',payLoad)
        state.projectInfos = localDb.get('projectInfos');
    },
}

const actions = {
    fetchGetProject({ commit }, payLoad) {
        getProject({}).then(data =>{
            if(data.data) {
                commit('setProjectInfos',data.data);
                return payLoad.sucCallback(data.msg)
            } else {
                return payLoad.falCallback(data.errors)
            }
        })
    }
}

const getters = {

}

export default {
    state,
    getters,
    actions,
    mutations,
}